import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
	{
		path: "/",
		name: "Layout",
		component: () => import("../views/layout"), // 路由懒加载 只有访问的时候才去加载
		children: [
			{
				path: "/home",
				component: () => import("../views/home"),
			},
			{
				path: "/classify",
				component: () => import("../views/classify"),
			},
			{
				path: "/my",
				component: () => import("../views/my"),
			},
		],
	},
	{
		path: "/address",
		name: "地址管理",
		component: () => import("../views/address"),
	},
	{
		path: "/address/edit/:id",
		name: "地址编辑",
		component: () => import("../views/address/edit"),
	},
	{
		path: "/address/new",
		name: "地址添加",
		component: () => import("../views/address/edit"),
	},
];

const router = new VueRouter({
	routes,
});

export default router;
